import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import {routes} from './routes'
Vue.config.productionTip = false

Vue.use(VueRouter);



const router = new VueRouter({
  routes,
  mode: 'history'
})

//全局守卫
// router.beforeEach((to, from, next) => {
//   if (to.path == '/login' || to.path == '/register') {
//     next();
//   } else {
//     next('/login');
//   }
// })

//后置钩子
// router.afterEach((to,from)=>{
//   alert("after each")
// })

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
